import 'package:distribution_mall_flutter/assets.dart';
import 'package:distribution_mall_flutter/constant/cf_constant.dart';
import 'package:distribution_mall_flutter/constant/constant.dart';
import 'package:distribution_mall_flutter/constant/image_constant.dart';
import 'package:distribution_mall_flutter/entity/order/detail/order_detail_entity.dart';
import 'package:distribution_mall_flutter/generated/l10n.dart';
import 'package:distribution_mall_flutter/provider/order/order_detail.dart';
import 'package:distribution_mall_flutter/utils/common_widget.dart';
import 'package:distribution_mall_flutter/utils/debug.dart';
import 'package:distribution_mall_flutter/utils/image_loader.dart';
import 'package:distribution_mall_flutter/router/router.gr.dart';
import 'package:distribution_mall_flutter/utils/utils.dart';
import 'package:distribution_mall_flutter/widgets/card.dart';
import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:skeletonizer/skeletonizer.dart';

class MerchantAuthCard extends ConsumerWidget {
  const MerchantAuthCard({super.key});

  @override
  Widget build(BuildContext context, WidgetRef ref) {
    var status = ref.watch(orderDetailMerchantAuthProvider);
    bool showAuthCard =
        status == null || status == 'REJECT' || status == 'REVIEW';
    return showAuthCard
        ? Skeleton.ignore(
            child: EPCard(
                onPressed: () {
                  appRouter.push(const MerchantAuthenticationRoute());
                },
                margin: const EdgeInsets.fromLTRB(EdgeConstant.edge10,
                    EdgeConstant.edge10, EdgeConstant.edge10, 0),
                enableClickEffect: true,
                child: Container(
                  width: double.infinity,
                  padding: const EdgeInsets.all(10),
                  child: Column(
                    mainAxisAlignment: MainAxisAlignment.spaceBetween,
                    crossAxisAlignment: CrossAxisAlignment.start,
                    children: [
                      Padding(
                          padding: const EdgeInsets.only(bottom: 6),
                          child: Text(
                              S.current
                                  .order_merchant_verification_page_top_hint,
                              style: const TextStyle(
                                  fontSize: 12, color: Colors.black))),
                      Row(
                        mainAxisAlignment: MainAxisAlignment.end,
                        children: [
                          Text(
                            S.current
                                .order_merchant_verification_page_bottom_hint,
                            style: const TextStyle(
                                color: Color(0xFFFF7B00), fontSize: 12),
                          ),
                          Container(
                            margin: const EdgeInsets.only(left: 7),
                            child: Image.asset(
                              Assets.assets_icons_grey_arrow_right_png,
                              height: 12,
                            ),
                          ),
                        ],
                      )
                    ],
                  ),
                )))
        : Container();
  }
}
